package org.leetcode.easy.leetcode454;

import java.util.Arrays;

public class Solution
{
    public int findContentChildren(int[] g, int[] s)
    {
        Arrays.sort(g);
        Arrays.sort(s);

        int number = 0;

        for (int i = 0; i < g.length; i++) {
            for (int j = 0; j < s.length; j++) {
                if (g[i]<=s[j])
                {
                    number++;
                    s[j]=0;
                    break;
                }
            }
        }

        return number;
    }

    public static void main(String[] args) {
        int [] g ={1,2,3};
        int [] s ={1,1};

        Solution solution = new Solution();

        int number = solution.findContentChildren(g, s);

        System.out.println(number);
    }
}
